\hypertarget{sc2__common_8h}{}\section{include/sc2api/sc2\+\_\+common.h File Reference}
\label{sc2__common_8h}\index{include/sc2api/sc2\+\_\+common.\+h@{include/sc2api/sc2\+\_\+common.\+h}}


Common data types, including points, rectangles and colors.  


{\ttfamily \#include $<$algorithm$>$}\newline
{\ttfamily \#include $<$cmath$>$}\newline
{\ttfamily \#include $<$cstdint$>$}\newline
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structsc2_1_1_point3_d}{sc2\+::\+Point3D}
\item 
struct \hyperlink{structsc2_1_1_point2_d}{sc2\+::\+Point2D}
\item 
struct \hyperlink{structsc2_1_1_rect2_d}{sc2\+::\+Rect2D}
\begin{DoxyCompactList}\small\item\em 2D rectangle. \end{DoxyCompactList}\item 
struct \hyperlink{structsc2_1_1_point2_d_i}{sc2\+::\+Point2\+DI}
\begin{DoxyCompactList}\small\item\em 2D integer point. \end{DoxyCompactList}\item 
struct \hyperlink{structsc2_1_1_rect2_d_i}{sc2\+::\+Rect2\+DI}
\begin{DoxyCompactList}\small\item\em 2D integer rectangle. \end{DoxyCompactList}\item 
struct \hyperlink{structsc2_1_1_color}{sc2\+::\+Color}
\begin{DoxyCompactList}\small\item\em R\+GB \hyperlink{structsc2_1_1_color}{Color}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{sc2__common_8h_a169145fe6d2f2b308b5d5496299e791d}\label{sc2__common_8h_a169145fe6d2f2b308b5d5496299e791d}} 
typedef Point2D {\bfseries sc2\+::\+Vector2D}
\item 
\mbox{\Hypertarget{sc2__common_8h_a4ba9646e0f90d9b7a629b86eb23461f3}\label{sc2__common_8h_a4ba9646e0f90d9b7a629b86eb23461f3}} 
typedef Point3D {\bfseries sc2\+::\+Vector3D}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{sc2__common_8h_a6a050d19a7dd81f132dfdb45e567476e}\label{sc2__common_8h_a6a050d19a7dd81f132dfdb45e567476e}} 
Point3D {\bfseries sc2\+::operator+} (const Point3D \&lhs, const Point3D \&rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_a9b4b0bb997b2c52b57302d81a2c6dfe0}\label{sc2__common_8h_a9b4b0bb997b2c52b57302d81a2c6dfe0}} 
Point3D {\bfseries sc2\+::operator-\/} (const Point3D \&lhs, const Point3D \&rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_a0368a6b163c72c5e8b7342249378acee}\label{sc2__common_8h_a0368a6b163c72c5e8b7342249378acee}} 
Point3D {\bfseries sc2\+::operator$\ast$} (const Point3D \&lhs, float rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_aff3d7950597ae0877f601da0fe944f90}\label{sc2__common_8h_aff3d7950597ae0877f601da0fe944f90}} 
Point3D {\bfseries sc2\+::operator$\ast$} (float lhs, const Point3D \&rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_a13c3184516ef7381c9d30ae7864bfd9b}\label{sc2__common_8h_a13c3184516ef7381c9d30ae7864bfd9b}} 
Point3D {\bfseries sc2\+::operator/} (const Point3D \&lhs, float rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_a8326f738c3a76fbb35afff6d82080cf1}\label{sc2__common_8h_a8326f738c3a76fbb35afff6d82080cf1}} 
Point3D {\bfseries sc2\+::operator/} (float lhs, const Point3D \&rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_a7d7f120c2191efa070f8619c33df97db}\label{sc2__common_8h_a7d7f120c2191efa070f8619c33df97db}} 
Point2D {\bfseries sc2\+::operator+} (const Point2D \&lhs, const Point2D \&rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_ad332e61d3bd4b23d77e2dc21546f1c78}\label{sc2__common_8h_ad332e61d3bd4b23d77e2dc21546f1c78}} 
Point2D {\bfseries sc2\+::operator-\/} (const Point2D \&lhs, const Point2D \&rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_aa9742e7533747a68373ecbb3af262487}\label{sc2__common_8h_aa9742e7533747a68373ecbb3af262487}} 
Point2D {\bfseries sc2\+::operator$\ast$} (const Point2D \&lhs, float rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_a5ecabe86a83b1902c56e83374d07c1ba}\label{sc2__common_8h_a5ecabe86a83b1902c56e83374d07c1ba}} 
Point2D {\bfseries sc2\+::operator$\ast$} (float lhs, const Point2D \&rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_a034072c303ef7ded529f4fa1547e11f7}\label{sc2__common_8h_a034072c303ef7ded529f4fa1547e11f7}} 
Point2D {\bfseries sc2\+::operator/} (const Point2D \&lhs, float rhs)
\item 
\mbox{\Hypertarget{sc2__common_8h_a4b3ac3afc8141fa729cd28ecb30dc61b}\label{sc2__common_8h_a4b3ac3afc8141fa729cd28ecb30dc61b}} 
Point2D {\bfseries sc2\+::operator/} (float lhs, const Point2D \&rhs)
\item 
float \hyperlink{sc2__common_8h_a846ab3c3ff7c33caf7da2dff90a4a171}{sc2\+::\+Get\+Random\+Scalar} ()
\item 
float \hyperlink{sc2__common_8h_a0de5bf2e0593ea26ef8dd93ee5456744}{sc2\+::\+Get\+Random\+Fraction} ()
\item 
int \hyperlink{sc2__common_8h_aa35b0863b3931b50ce517abab8d06018}{sc2\+::\+Get\+Random\+Integer} (int min, int max)
\item 
{\footnotesize template$<$typename Container $>$ }\\Container\+::value\+\_\+type \& \hyperlink{sc2__common_8h_abc67208faaf8b25c157b46bb6f96e5a5}{sc2\+::\+Get\+Random\+Entry} (Container \&container)
\item 
float \hyperlink{sc2__common_8h_a828525a11f27628914021c21736f2810}{sc2\+::\+Distance2D} (const Point2D \&a, const Point2D \&b)
\item 
float \hyperlink{sc2__common_8h_a9c649eca988aae078b7e72d087c2459f}{sc2\+::\+Distance\+Squared2D} (const Point2D \&a, const Point2D \&b)
\item 
void \hyperlink{sc2__common_8h_a32b33904e90d1de59f334c664971c70a}{sc2\+::\+Normalize2D} (Point2D \&a)
\item 
float \hyperlink{sc2__common_8h_a5fc6c7967b887f2f9e1338db01a9d079}{sc2\+::\+Dot2D} (const Point2D \&a, const Point2D \&b)
\item 
float \hyperlink{sc2__common_8h_a68da467a343f431544f3cea7c105bcde}{sc2\+::\+Distance3D} (const Point3D \&a, const Point3D \&b)
\item 
float \hyperlink{sc2__common_8h_a8019c6d22ca3004461370617a00a4644}{sc2\+::\+Distance\+Squared3D} (const Point3D \&a, const Point3D \&b)
\item 
void \hyperlink{sc2__common_8h_ab4edfeead03941be04ed2fca1ed4e551}{sc2\+::\+Normalize3D} (Point3D \&a)
\item 
float \hyperlink{sc2__common_8h_a9c24088000a232e811c93759fc08bad9}{sc2\+::\+Dot3D} (const Point3D \&a, const Point3D \&b)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
Common data types, including points, rectangles and colors. 



\subsection{Function Documentation}
\mbox{\Hypertarget{sc2__common_8h_file_a828525a11f27628914021c21736f2810}\label{sc2__common_8h_file_a828525a11f27628914021c21736f2810}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Distance2D@{Distance2D}}
\index{Distance2D@{Distance2D}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Distance2\+D()}{Distance2D()}}
{\footnotesize\ttfamily float sc2\+::\+Distance2D (\begin{DoxyParamCaption}\item[{const \hyperlink{structsc2_1_1_point2_d}{Point2D} \&}]{a,  }\item[{const \hyperlink{structsc2_1_1_point2_d}{Point2D} \&}]{b }\end{DoxyParamCaption})}

The distance between two 2D points. 
\begin{DoxyParams}{Parameters}
{\em a} & First point. \\
\hline
{\em b} & Second point. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Distance. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_a68da467a343f431544f3cea7c105bcde}\label{sc2__common_8h_file_a68da467a343f431544f3cea7c105bcde}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Distance3D@{Distance3D}}
\index{Distance3D@{Distance3D}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Distance3\+D()}{Distance3D()}}
{\footnotesize\ttfamily float sc2\+::\+Distance3D (\begin{DoxyParamCaption}\item[{const \hyperlink{structsc2_1_1_point3_d}{Point3D} \&}]{a,  }\item[{const \hyperlink{structsc2_1_1_point3_d}{Point3D} \&}]{b }\end{DoxyParamCaption})}

The distance between two 3D points. 
\begin{DoxyParams}{Parameters}
{\em a} & First point. \\
\hline
{\em b} & Second point. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Distance. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_a9c649eca988aae078b7e72d087c2459f}\label{sc2__common_8h_file_a9c649eca988aae078b7e72d087c2459f}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Distance\+Squared2D@{Distance\+Squared2D}}
\index{Distance\+Squared2D@{Distance\+Squared2D}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Distance\+Squared2\+D()}{DistanceSquared2D()}}
{\footnotesize\ttfamily float sc2\+::\+Distance\+Squared2D (\begin{DoxyParamCaption}\item[{const \hyperlink{structsc2_1_1_point2_d}{Point2D} \&}]{a,  }\item[{const \hyperlink{structsc2_1_1_point2_d}{Point2D} \&}]{b }\end{DoxyParamCaption})}

The distance squared between two 2D points, faster than Distance2D. 
\begin{DoxyParams}{Parameters}
{\em a} & First point. \\
\hline
{\em b} & Second point. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Distance$^\wedge$2. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_a8019c6d22ca3004461370617a00a4644}\label{sc2__common_8h_file_a8019c6d22ca3004461370617a00a4644}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Distance\+Squared3D@{Distance\+Squared3D}}
\index{Distance\+Squared3D@{Distance\+Squared3D}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Distance\+Squared3\+D()}{DistanceSquared3D()}}
{\footnotesize\ttfamily float sc2\+::\+Distance\+Squared3D (\begin{DoxyParamCaption}\item[{const \hyperlink{structsc2_1_1_point3_d}{Point3D} \&}]{a,  }\item[{const \hyperlink{structsc2_1_1_point3_d}{Point3D} \&}]{b }\end{DoxyParamCaption})}

The distance squared between two 3D points, faster than Distance3D. 
\begin{DoxyParams}{Parameters}
{\em a} & First point. \\
\hline
{\em b} & Second point. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Distance$^\wedge$2. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_a5fc6c7967b887f2f9e1338db01a9d079}\label{sc2__common_8h_file_a5fc6c7967b887f2f9e1338db01a9d079}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Dot2D@{Dot2D}}
\index{Dot2D@{Dot2D}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Dot2\+D()}{Dot2D()}}
{\footnotesize\ttfamily float sc2\+::\+Dot2D (\begin{DoxyParamCaption}\item[{const \hyperlink{structsc2_1_1_point2_d}{Point2D} \&}]{a,  }\item[{const \hyperlink{structsc2_1_1_point2_d}{Point2D} \&}]{b }\end{DoxyParamCaption})}

The dot product of two 2D vectors. 
\begin{DoxyParams}{Parameters}
{\em a} & First vector. \\
\hline
{\em b} & Second vector. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Dot product. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_a9c24088000a232e811c93759fc08bad9}\label{sc2__common_8h_file_a9c24088000a232e811c93759fc08bad9}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Dot3D@{Dot3D}}
\index{Dot3D@{Dot3D}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Dot3\+D()}{Dot3D()}}
{\footnotesize\ttfamily float sc2\+::\+Dot3D (\begin{DoxyParamCaption}\item[{const \hyperlink{structsc2_1_1_point3_d}{Point3D} \&}]{a,  }\item[{const \hyperlink{structsc2_1_1_point3_d}{Point3D} \&}]{b }\end{DoxyParamCaption})}

The dot product of two 3D vectors. 
\begin{DoxyParams}{Parameters}
{\em a} & First vector. \\
\hline
{\em b} & Second vector. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Dot product. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_abc67208faaf8b25c157b46bb6f96e5a5}\label{sc2__common_8h_file_abc67208faaf8b25c157b46bb6f96e5a5}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Get\+Random\+Entry@{Get\+Random\+Entry}}
\index{Get\+Random\+Entry@{Get\+Random\+Entry}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Get\+Random\+Entry()}{GetRandomEntry()}}
{\footnotesize\ttfamily template$<$typename Container $>$ \\
Container\+::value\+\_\+type\& sc2\+::\+Get\+Random\+Entry (\begin{DoxyParamCaption}\item[{Container \&}]{container }\end{DoxyParamCaption})}

Gets a random entry from the container. 
\begin{DoxyParams}{Parameters}
{\em container} & Array, list or whatever container. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A random entry. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_a0de5bf2e0593ea26ef8dd93ee5456744}\label{sc2__common_8h_file_a0de5bf2e0593ea26ef8dd93ee5456744}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Get\+Random\+Fraction@{Get\+Random\+Fraction}}
\index{Get\+Random\+Fraction@{Get\+Random\+Fraction}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Get\+Random\+Fraction()}{GetRandomFraction()}}
{\footnotesize\ttfamily float sc2\+::\+Get\+Random\+Fraction (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

Gets a random floating-\/point number between 0.\+0 and 1.\+0. \begin{DoxyReturn}{Returns}
Random floating-\/point number between 0.\+0 and 1.\+0. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_aa35b0863b3931b50ce517abab8d06018}\label{sc2__common_8h_file_aa35b0863b3931b50ce517abab8d06018}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Get\+Random\+Integer@{Get\+Random\+Integer}}
\index{Get\+Random\+Integer@{Get\+Random\+Integer}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Get\+Random\+Integer()}{GetRandomInteger()}}
{\footnotesize\ttfamily int sc2\+::\+Get\+Random\+Integer (\begin{DoxyParamCaption}\item[{int}]{min,  }\item[{int}]{max }\end{DoxyParamCaption})}

Gets a random integer between min and max inclusive. 
\begin{DoxyParams}{Parameters}
{\em min} & Smallest value a random number could be. \\
\hline
{\em max} & Largest value a random number could be. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Random integer between min and max. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_a846ab3c3ff7c33caf7da2dff90a4a171}\label{sc2__common_8h_file_a846ab3c3ff7c33caf7da2dff90a4a171}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Get\+Random\+Scalar@{Get\+Random\+Scalar}}
\index{Get\+Random\+Scalar@{Get\+Random\+Scalar}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Get\+Random\+Scalar()}{GetRandomScalar()}}
{\footnotesize\ttfamily float sc2\+::\+Get\+Random\+Scalar (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

Gets a random floating-\/point number between -\/1.\+0 and 1.\+0. \begin{DoxyReturn}{Returns}
Random floating-\/point number between -\/1.\+0 and 1.\+0. 
\end{DoxyReturn}
\mbox{\Hypertarget{sc2__common_8h_file_a32b33904e90d1de59f334c664971c70a}\label{sc2__common_8h_file_a32b33904e90d1de59f334c664971c70a}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Normalize2D@{Normalize2D}}
\index{Normalize2D@{Normalize2D}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Normalize2\+D()}{Normalize2D()}}
{\footnotesize\ttfamily void sc2\+::\+Normalize2D (\begin{DoxyParamCaption}\item[{\hyperlink{structsc2_1_1_point2_d}{Point2D} \&}]{a }\end{DoxyParamCaption})}

Normalize a 2D point. 
\begin{DoxyParams}{Parameters}
{\em a} & Point. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{sc2__common_8h_file_ab4edfeead03941be04ed2fca1ed4e551}\label{sc2__common_8h_file_ab4edfeead03941be04ed2fca1ed4e551}} 
\index{sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}!Normalize3D@{Normalize3D}}
\index{Normalize3D@{Normalize3D}!sc2\+\_\+common.\+h@{sc2\+\_\+common.\+h}}
\subsubsection{\texorpdfstring{Normalize3\+D()}{Normalize3D()}}
{\footnotesize\ttfamily void sc2\+::\+Normalize3D (\begin{DoxyParamCaption}\item[{\hyperlink{structsc2_1_1_point3_d}{Point3D} \&}]{a }\end{DoxyParamCaption})}

Normalize a 3D point. 
\begin{DoxyParams}{Parameters}
{\em a} & Point. \\
\hline
\end{DoxyParams}
